package com.junjie.checkin.controller;

import com.junjie.checkin.request.user.UserPageRequest;
import com.junjie.checkin.response.PageResult;
import com.junjie.checkin.response.Result;
import com.junjie.checkin.response.ResultStatus;
import com.junjie.checkin.response.admin.ActivityResponse;
import com.junjie.checkin.response.front.UserFrontResponse;
import com.junjie.checkin.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 洪浚杰
 * @description
 * @date 2025/6/15 17:54
 */
@RestController
public class LeaderboardController{
    @Autowired
    private UserService userService;


    /**
     * 获取前台用户排行榜(修复BUG)
     * @param userPageRequest
     * @return
     */
    @GetMapping("/leaderboard")
    public Result<PageResult<UserFrontResponse>> getLeaderboard(UserPageRequest userPageRequest){
        userPageRequest.initDefaults();
        PageResult<UserFrontResponse> pageResult = userService.getPageLatestUsers(userPageRequest);
        return Result.getResult(ResultStatus.OK,pageResult);
    }
}
